package com.wuyu.acl.common.exception;

import com.wuyu.acl.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(CustomException.class)
    public Result handle(CustomException e) {
        e.printStackTrace();
        return Result.fail(e.getResultCodeEnum());
    }

    @ExceptionHandler(Exception.class)
    public Result handle(Exception e) {
        e.printStackTrace();
        return Result.fail(e.getMessage());
    }
}
